home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 1 / Precision Software Applications Silver Collection Volume One (PSM) (1993).iso / windows / games / wincapt.arj / DIBAPI.H < prev    next >
Text File  |  1992-06-18  |  6KB  |  126 lines

  1. /*
  2.  *  dibapi.h
  3.  *
  4.  *  Copyright (c) 1991 Microsoft Corporation. All rights reserved
  5.  *
  6.  *  Header file for Device-Independent Bitmap (DIB) API.  Provides
  7.  *  function prototypes and constants for the following functions:
  8.  *
  9.  *  BitmapToDIB()        - Creates a DIB from a bitmap
  10.  *  ChangeBitmapFormat() - Changes a bitmap to a specified DIB format
  11.  *  ChangeDIBFormat()    - Changes a DIB's BPP and/or compression format
  12.  *  CopyScreenToBitmap() - Copies entire screen to a standard Bitmap
  13.  *  CopyScreenToDIB()    - Copies entire screen to a DIB
  14.  *  CopyWindowToBitmap() - Copies a window to a standard Bitmap
  15.  *  CopyWindowToDIB()    - Copies a window to a DIB
  16.  *  CreateDIBPalette()   - Creates a palette from a DIB
  17.  *  CreateDIB()          - Creates a new DIB
  18.  *  DestroyDIB()         - Deletes DIB when finished using it
  19.  *  DIBError()           - Displays message box with error message
  20.  *  DIBHeight()          - Gets the DIB height
  21.  *  DIBNumColors()       - Calculates number of colors in the DIB's color table
  22.  *  DIBToBitmap()        - Creates a bitmap from a DIB
  23.  *  DIBWidth()           - Gets the DIB width
  24.  *  FindDIBBits()        - Sets pointer to the DIB bits
  25.  *  GetSystemPalette()   - Gets the current palette
  26.  *  LoadDIB()            - Loads a DIB from a file
  27.  *  PaintBitmap()        - Displays standard bitmap in the specified DC
  28.  *  PaintDIB()           - Displays DIB in the specified DC
  29.  *  PalEntriesOnDevice() - Gets the number of palette entries
  30.  *  PaletteSize()        - Calculates the buffer size required by a palette
  31.  *  PrintDIB()           - Prints the specified DIB
  32.  *  PrintScreen()        - Prints the entire screen
  33.  *  PrintWindow()        - Prints all or part of a window
  34.  *  SaveDIB()            - Saves the specified dib in a file
  35.  *
  36.  * See the file DIBAPI.TXT for more information about these functions.
  37.  *
  38.  */
  39.  
  40.  
  41. /* Handle to a DIB */
  42. #define HDIB HANDLE
  43.  
  44.  
  45. /* Print Area selection */
  46. #define PW_WINDOW        1
  47. #define PW_CLIENT        2
  48.  
  49.  
  50. /* Print Options selection */
  51. #define PW_BESTFIT       1
  52. #define PW_STRETCHTOPAGE 2
  53. #define PW_SCALE         3
  54.  
  55. /* DIB Macros*/
  56.  
  57. // WIDTHBYTES performs DWORD-aligning of DIB scanlines.  The "bits"
  58. // parameter is the bit count for the scanline (biWidth * biBitCount),
  59. // and this macro returns the number of DWORD-aligned bytes needed 
  60. // to hold those bits.
  61.  
  62. #define WIDTHBYTES(bits)    (((bits) + 31) / 32 * 4)
  63.  
  64. /* Error constants */
  65. enum {
  66.       ERR_MIN = 0,                     // All error #s >= this value
  67.       ERR_NOT_DIB = 0,                 // Tried to load a file, NOT a DIB!
  68.       ERR_MEMORY,                      // Not enough memory!
  69.       ERR_READ,                        // Error reading file!
  70.       ERR_LOCK,                        // Error on a GlobalLock()!
  71.       ERR_OPEN,                        // Error opening a file!
  72.       ERR_CREATEPAL,                   // Error creating palette.
  73.       ERR_GETDC,                       // Couldn't get a DC.
  74.       ERR_CREATEDDB,                   // Error create a DDB.
  75.       ERR_STRETCHBLT,                  // StretchBlt() returned failure.
  76.       ERR_STRETCHDIBITS,               // StretchDIBits() returned failure.
  77.       ERR_SETDIBITSTODEVICE,           // SetDIBitsToDevice() failed.
  78.       ERR_STARTDOC,                    // Error calling StartDoc().
  79.       ERR_NOGDIMODULE,                 // Couldn't find GDI module in memory.
  80.       ERR_SETABORTPROC,                // Error calling SetAbortProc().
  81.       ERR_STARTPAGE,                   // Error calling StartPage().
  82.       ERR_NEWFRAME,                    // Error calling NEWFRAME escape.
  83.       ERR_ENDPAGE,                     // Error calling EndPage().
  84.       ERR_ENDDOC,                      // Error calling EndDoc().
  85.       ERR_SETDIBITS,                   // Error calling SetDIBits().
  86.       ERR_FILENOTFOUND,                // Error opening file in GetDib()
  87.       ERR_INVALIDHANDLE,               // Invalid Handle
  88.       ERR_DIBFUNCTION,                 // Error on call to DIB function
  89.       ERR_MAX                          // All error #s < this value
  90.      };
  91.  
  92.  
  93.  
  94. /* Function prototypes */
  95.  
  96. HDIB      FAR  BitmapToDIB (HBITMAP hBitmap, HPALETTE hPal);
  97. HDIB      FAR  ChangeBitmapFormat (HBITMAP  hBitmap,
  98.                                    WORD     wBitCount,
  99.                                    DWORD    dwCompression,
  100.                                    HPALETTE hPal);
  101. HDIB      FAR  ChangeDIBFormat (HDIB hDIB, WORD wBitCount,
  102.                                 DWORD dwCompression);
  103. HBITMAP   FAR  CopyScreenToBitmap (LPRECT);
  104. HDIB      FAR  CopyScreenToDIB (LPRECT);
  105. HBITMAP   FAR  CopyWindowToBitmap (HWND, WORD);
  106. HDIB      FAR  CopyWindowToDIB (HWND, WORD);
  107. HPALETTE  FAR  CreateDIBPalette (HDIB hDIB);
  108. HDIB      FAR  CreateDIB(DWORD, DWORD, WORD);
  109. WORD      FAR  DestroyDIB (HDIB);
  110. void      FAR  DIBError (int ErrNo);
  111. DWORD     FAR  DIBHeight (LPSTR lpDIB);
  112. WORD      FAR  DIBNumColors (LPSTR lpDIB);
  113. HBITMAP   FAR  DIBToBitmap (HDIB hDIB, HPALETTE hPal);
  114. DWORD     FAR  DIBWidth (LPSTR lpDIB);
  115. LPSTR     FAR  FindDIBBits (LPSTR lpDIB);
  116. HPALETTE  FAR  GetSystemPalette (void);
  117. HDIB      FAR  LoadDIB (LPSTR);
  118. BOOL      FAR  PaintBitmap (HDC, LPRECT, HBITMAP, LPRECT, HPALETTE);
  119. BOOL      FAR  PaintDIB (HDC, LPRECT, HDIB, LPRECT, HPALETTE);
  120. int       FAR  PalEntriesOnDevice (HDC hDC);
  121. WORD      FAR  PaletteSize (LPSTR lpDIB);
  122. WORD      FAR  PrintDIB (HDIB, WORD, WORD, WORD, LPSTR);
  123. WORD      FAR  PrintScreen (LPRECT, WORD, WORD, WORD, LPSTR);
  124. WORD      FAR  PrintWindow (HWND, WORD, WORD, WORD, WORD, LPSTR);
  125. WORD      FAR  SaveDIB (HDIB, LPSTR);
  126.